package com.scs.application.modules.upms.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import com.scs.application.core.mvc.validation.constraints.Mobile;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @Description: 用户导入等功能
 */
@Data
public class UserDTO implements IExcelModel, IExcelDataModel {

    /** 导入的时候会设置为 id */
    @Excel(name = "登录账号", width = 20)
    @NotBlank(message = "登录账号不能为空")
    private String loginKey;

    @Excel(name = "昵称", width = 20)
    @NotBlank(message = "昵称不能为空")
    private String nickname;

    /** 导入的时候会设置为 officeId */
    @Excel(name = "机构代码")
    @NotBlank(message = "机构代码错误")
    private String officeCode;

    @Excel(name = "机构名称", width = 20)
    private String officeName;

    @Excel(name = "启用状态", dict = "common_inactive")
    @NotNull(message = "启用状态不能为空")
    private Integer inactive;

    @Excel(name = "手机号", width = 15)
    @Mobile(message = "手机号格式错误")
    private String mobile;

    @Excel(name = "邮箱", width = 20)
    @Email(message = "邮箱格式错误")
    private String email;

    @Excel(name = "备注", width = 30)
    private String remark;

    @Excel(name = "错误消息")
    private String errorMsg;

    @Excel(name = "错误行号")
    private Integer rowNum;

    /** 当导入时，officeCode存在的情况下自动设置当前字段的值 */
    private String officeId;

    /** 当导入时，loginKey存在的情况下自动设置当前字段的值 */
    private String id;



    @Override
    public String getErrorMsg() {
        return errorMsg;
    }

    @Override
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    @Override
    public Integer getRowNum() {
        return rowNum;
    }

    @Override
    public void setRowNum(Integer rowNum) {
        this.rowNum = rowNum;
    }
}
